<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

	protected function _initDoctype () {
		$this->bootstrap( 'view' );
		$view = $this->getResource( 'view' );
		$view->doctype( 'XHTML1_STRICT' );
		
		//jquery support
		$view->addHelperPath( "ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper" );
		$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
		$viewRenderer->setView( $view );
		Zend_Controller_Action_HelperBroker::addHelper( $viewRenderer );
		
		//DB config
		$config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV );
		$db = Zend_Db::factory( $config->database );
		Zend_DB_Table_Abstract::setDefaultAdapter( $db );
		
		//firePHP for sql queries
		$profiler = new Zend_Db_Profiler_Firebug( 'All DB Queries' );
		$profiler->setEnabled( true );
		$db->setProfiler( $profiler );
		
		//router config
		$config = new Zend_Config_Ini( APPLICATION_PATH . '/configs/router.ini', 'production' );
		$router = new Zend_Controller_Router_Rewrite();
		$router->addConfig( $config, 'routes' );
		
		$controller = Zend_Controller_Front::getInstance();
		$controller->setRouter( $router );
	
	}

}

